package com.lyun.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lyun.pojo.MovementLike;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface MovementLikeMapper extends BaseMapper<MovementLike> {

    @Select("select COUNT(1) from tbl_movement_like where movement_id = #{movementId} and user_id = #{selfId}")
    int isLiked(Long movementId, Long selfId);

    @Select("select COUNT(1) from tbl_movement_like where movement_id = #{movementId} and user_id = #{selfId}")
    int isLoved(Long movementId, Long selfId);

    @Select("select count(1) from tbl_movement_like where movement_id = #{id} and is_like = 1")
    int getLikeCountByMovementId(Long id);

    @Select("select count(1) from tbl_movement_like where movement_id = #{id} and is_love = 1")
    int getLoveCountByMovementId(Long id);
}
